.class public Lweibo4android/IDs;
.super Lweibo4android/WeiboResponse;
.source "IDs.java"


# static fields
.field private static ROOT_NODE_NAMES:[Ljava/lang/String; = null

.field private static final serialVersionUID:J = -0x5b62b6c47b2132b9L


# instance fields
.field private ids:[J

.field private nextCursor:J

.field private previousCursor:J


# direct methods
.method static constructor <clinit>()V
    .locals 3

    .prologue
    .line 50
    const/4 v0, 0x2

    new-array v0, v0, [Ljava/lang/String;

    const/4 v1, 0x0

    const-string v2, "id_list"

    aput-object v2, v0, v1

    const/4 v1, 0x1

    const-string v2, "ids"

    aput-object v2, v0, v1

    sput-object v0, Lweibo4android/IDs;->ROOT_NODE_NAMES:[Ljava/lang/String;

    .line 45
    return-void
.end method

.method constructor <init>(Lweibo4android/http/Response;)V
    .locals 7
    .parameter "res"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lweibo4android/WeiboException;
        }
    .end annotation

    .prologue
    .line 53
    invoke-direct {p0, p1}, Lweibo4android/WeiboResponse;-><init>(Lweibo4android/http/Response;)V

    .line 54
    invoke-virtual {p1}, Lweibo4android/http/Response;->asDocument()Lorg/w3c/dom/Document;

    move-result-object v4

    invoke-interface {v4}, Lorg/w3c/dom/Document;->getDocumentElement()Lorg/w3c/dom/Element;

    move-result-object v0

    .line 55
    .local v0, elem:Lorg/w3c/dom/Element;
    sget-object v4, Lweibo4android/IDs;->ROOT_NODE_NAMES:[Ljava/lang/String;

    invoke-static {v4, v0}, Lweibo4android/IDs;->ensureRootNodeNameIs([Ljava/lang/String;Lorg/w3c/dom/Element;)V

    .line 56
    const-string v4, "id"

    invoke-interface {v0, v4}, Lorg/w3c/dom/Element;->getElementsByTagName(Ljava/lang/String;)Lorg/w3c/dom/NodeList;

    move-result-object v2

    .line 57
    .local v2, idlist:Lorg/w3c/dom/NodeList;
    invoke-interface {v2}, Lorg/w3c/dom/NodeList;->getLength()I

    move-result v4

    new-array v4, v4, [J

    iput-object v4, p0, Lweibo4android/IDs;->ids:[J

    .line 58
    const/4 v1, 0x0

    .local v1, i:I
    :goto_0
    invoke-interface {v2}, Lorg/w3c/dom/NodeList;->getLength()I

    move-result v4

    if-lt v1, v4, :cond_0

    .line 65
    const-string v4, "previous_cursor"

    invoke-static {v4, v0}, Lweibo4android/IDs;->getChildLong(Ljava/lang/String;Lorg/w3c/dom/Element;)J

    move-result-wide v4

    iput-wide v4, p0, Lweibo4android/IDs;->previousCursor:J

    .line 66
    const-string v4, "next_cursor"

    invoke-static {v4, v0}, Lweibo4android/IDs;->getChildLong(Ljava/lang/String;Lorg/w3c/dom/Element;)J

    move-result-wide v4

    iput-wide v4, p0, Lweibo4android/IDs;->nextCursor:J

    .line 67
    return-void

    .line 60
    :cond_0
    :try_start_0
    iget-object v4, p0, Lweibo4android/IDs;->ids:[J

    invoke-interface {v2, v1}, Lorg/w3c/dom/NodeList;->item(I)Lorg/w3c/dom/Node;

    move-result-object v5

    invoke-interface {v5}, Lorg/w3c/dom/Node;->getFirstChild()Lorg/w3c/dom/Node;

    move-result-object v5

    invoke-interface {v5}, Lorg/w3c/dom/Node;->getNodeValue()Ljava/lang/String;

    move-result-object v5

    invoke-static {v5}, Ljava/lang/Long;->parseLong(Ljava/lang/String;)J

    move-result-wide v5

    aput-wide v5, v4, v1
    :try_end_0
    .catch Ljava/lang/NumberFormatException; {:try_start_0 .. :try_end_0} :catch_0

    .line 58
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .line 61
    :catch_0
    move-exception v3

    .line 62
    .local v3, nfe:Ljava/lang/NumberFormatException;
    new-instance v4, Lweibo4android/WeiboException;

    new-instance v5, Ljava/lang/StringBuilder;

    const-string v6, "Weibo API returned malformed response: "

    invoke-direct {v5, v6}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v5, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-direct {v4, v5, v3}, Lweibo4android/WeiboException;-><init>(Ljava/lang/String;Ljava/lang/Exception;)V

    throw v4
.end method

.method constructor <init>(Lweibo4android/http/Response;Lweibo4android/Weibo;)V
    .locals 9
    .parameter "res"
    .parameter "w"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lweibo4android/WeiboException;
        }
    .end annotation

    .prologue
    const-wide/16 v7, 0x0

    .line 70
    invoke-direct {p0, p1}, Lweibo4android/WeiboResponse;-><init>(Lweibo4android/http/Response;)V

    .line 71
    const-string v5, "[]\n"

    invoke-virtual {p1}, Lweibo4android/http/Response;->asString()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v5, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v5

    if-eqz v5, :cond_1

    .line 72
    iput-wide v7, p0, Lweibo4android/IDs;->previousCursor:J

    .line 73
    iput-wide v7, p0, Lweibo4android/IDs;->nextCursor:J

    .line 74
    const/4 v5, 0x0

    new-array v5, v5, [J

    iput-object v5, p0, Lweibo4android/IDs;->ids:[J

    .line 95
    :cond_0
    return-void

    .line 77
    :cond_1
    invoke-virtual {p1}, Lweibo4android/http/Response;->asJSONObject()Lweibo4android/org/json/JSONObject;

    move-result-object v1

    .line 79
    .local v1, json:Lweibo4android/org/json/JSONObject;
    :try_start_0
    const-string v5, "previous_cursor"

    invoke-virtual {v1, v5}, Lweibo4android/org/json/JSONObject;->getLong(Ljava/lang/String;)J

    move-result-wide v5

    iput-wide v5, p0, Lweibo4android/IDs;->previousCursor:J

    .line 80
    const-string v5, "next_cursor"

    invoke-virtual {v1, v5}, Lweibo4android/org/json/JSONObject;->getLong(Ljava/lang/String;)J

    move-result-wide v5

    iput-wide v5, p0, Lweibo4android/IDs;->nextCursor:J

    .line 82
    const-string v5, "ids"

    invoke-virtual {v1, v5}, Lweibo4android/org/json/JSONObject;->isNull(Ljava/lang/String;)Z

    move-result v5

    if-nez v5, :cond_0

    .line 83
    const-string v5, "ids"

    invoke-virtual {v1, v5}, Lweibo4android/org/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lweibo4android/org/json/JSONArray;

    move-result-object v2

    .line 84
    .local v2, jsona:Lweibo4android/org/json/JSONArray;
    invoke-virtual {v2}, Lweibo4android/org/json/JSONArray;->length()I

    move-result v4

    .line 85
    .local v4, size:I
    new-array v5, v4, [J

    iput-object v5, p0, Lweibo4android/IDs;->ids:[J

    .line 86
    const/4 v0, 0x0

    .local v0, i:I
    :goto_0
    if-ge v0, v4, :cond_0

    .line 87
    iget-object v5, p0, Lweibo4android/IDs;->ids:[J

    invoke-virtual {v2, v0}, Lweibo4android/org/json/JSONArray;->getLong(I)J

    move-result-wide v6

    aput-wide v6, v5, v0
    :try_end_0
    .catch Lweibo4android/org/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    .line 86
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    .line 91
    .end local v0           #i:I
    .end local v2           #jsona:Lweibo4android/org/json/JSONArray;
    .end local v4           #size:I
    :catch_0
    move-exception v3

    .line 92
    .local v3, jsone:Lweibo4android/org/json/JSONException;
    new-instance v5, Lweibo4android/WeiboException;

    invoke-direct {v5, v3}, Lweibo4android/WeiboException;-><init>(Ljava/lang/Exception;)V

    throw v5
.end method


# virtual methods
.method public equals(Ljava/lang/Object;)Z
    .locals 5
    .parameter "o"

    .prologue
    const/4 v1, 0x1

    const/4 v2, 0x0

    .line 135
    if-ne p0, p1, :cond_1

    .line 142
    :cond_0
    :goto_0
    return v1

    .line 136
    :cond_1
    instance-of v3, p1, Lweibo4android/IDs;

    if-nez v3, :cond_2

    move v1, v2

    goto :goto_0

    :cond_2
    move-object v0, p1

    .line 138
    check-cast v0, Lweibo4android/IDs;

    .line 140
    .local v0, iDs:Lweibo4android/IDs;
    iget-object v3, p0, Lweibo4android/IDs;->ids:[J

    iget-object v4, v0, Lweibo4android/IDs;->ids:[J

    invoke-static {v3, v4}, Ljava/util/Arrays;->equals([J[J)Z

    move-result v3

    if-nez v3, :cond_0

    move v1, v2

    goto :goto_0
.end method

.method public getIDs()[J
    .locals 1

    .prologue
    .line 98
    iget-object v0, p0, Lweibo4android/IDs;->ids:[J

    return-object v0
.end method

.method public getNextCursor()J
    .locals 2

    .prologue
    .line 130
    iget-wide v0, p0, Lweibo4android/IDs;->nextCursor:J

    return-wide v0
.end method

.method public getPreviousCursor()J
    .locals 2

    .prologue
    .line 114
    iget-wide v0, p0, Lweibo4android/IDs;->previousCursor:J

    return-wide v0
.end method

.method public hasNext()Z
    .locals 4

    .prologue
    .line 122
    const-wide/16 v0, 0x0

    iget-wide v2, p0, Lweibo4android/IDs;->nextCursor:J

    cmp-long v0, v0, v2

    if-eqz v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public hasPrevious()Z
    .locals 4

    .prologue
    .line 106
    const-wide/16 v0, 0x0

    iget-wide v2, p0, Lweibo4android/IDs;->previousCursor:J

    cmp-long v0, v0, v2

    if-eqz v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public hashCode()I
    .locals 1

    .prologue
    .line 147
    iget-object v0, p0, Lweibo4android/IDs;->ids:[J

    if-eqz v0, :cond_0

    iget-object v0, p0, Lweibo4android/IDs;->ids:[J

    invoke-static {v0}, Ljava/util/Arrays;->hashCode([J)I

    move-result v0

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public toString()Ljava/lang/String;
    .locals 3

    .prologue
    .line 152
    new-instance v0, Ljava/lang/StringBuilder;

    const-string v1, "IDs{ids="

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    .line 153
    iget-object v1, p0, Lweibo4android/IDs;->ids:[J

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    .line 154
    const-string v1, ", previousCursor="

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget-wide v1, p0, Lweibo4android/IDs;->previousCursor:J

    invoke-virtual {v0, v1, v2}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v0

    .line 155
    const-string v1, ", nextCursor="

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget-wide v1, p0, Lweibo4android/IDs;->nextCursor:J

    invoke-virtual {v0, v1, v2}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v0

    .line 156
    const/16 v1, 0x7d

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    move-result-object v0

    .line 152
    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method
